<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>tinydtls: numeric.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">tinydtls
   &#160;<span id="projectnumber">0.8.2</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Groups</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">numeric.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="numeric_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/* dtls -- a very basic DTLS implementation</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * Copyright (C) 2011 Olaf Bergmann &lt;bergmann@tzi.org&gt;</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> * Permission is hereby granted, free of charge, to any person</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * obtaining a copy of this software and associated documentation</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * files (the &quot;Software&quot;), to deal in the Software without</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> * restriction, including without limitation the rights to use, copy,</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * modify, merge, publish, distribute, sublicense, and/or sell copies</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> * of the Software, and to permit persons to whom the Software is</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> * furnished to do so, subject to the following conditions:</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> * The above copyright notice and this permission notice shall be</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> * included in all copies or substantial portions of the Software.</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"> * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment"> * SOFTWARE.</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor">#ifndef _DTLS_NUMERIC_H_</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define _DTLS_NUMERIC_H_</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#include &lt;stdint.h&gt;</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#ifndef min</span></div>
<div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="numeric_8h.html#a2d017cd3beb218080a7988e2deed2a11">   32</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define min(A,B) ((A) &lt;= (B) ? (A) : (B))</span></div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="preprocessor">#ifndef max</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="numeric_8h.html#a24e753bacac6be5f30e18f8a2bdefda4">   36</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define max(A,B) ((A) &lt; (B) ? (B) : (A))</span></div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="comment">/* this one is for consistency... */</span></div>
<div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="numeric_8h.html#a7b602967e2fc28b0be02bd4585e255d0">   40</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="numeric_8h.html#a7b602967e2fc28b0be02bd4585e255d0">dtls_int_to_uint8</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *field, uint8_t value)</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;{</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;  field[0] = value &amp; 0xff;</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;  <span class="keywordflow">return</span> 1;</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;}</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;</div>
<div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="numeric_8h.html#a074d352855e1ffde4c2ddb6a6fea01b9">   46</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="numeric_8h.html#a074d352855e1ffde4c2ddb6a6fea01b9">dtls_int_to_uint16</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *field, uint16_t value)</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;{</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;  field[0] = (value &gt;&gt; 8) &amp; 0xff;</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;  field[1] = value &amp; 0xff;</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;  <span class="keywordflow">return</span> 2;</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;}</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;</div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="numeric_8h.html#aff276cdd846cd194a21e9c61549292f6">   53</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="numeric_8h.html#aff276cdd846cd194a21e9c61549292f6">dtls_int_to_uint24</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *field, uint32_t value)</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;{</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;  field[0] = (value &gt;&gt; 16) &amp; 0xff;</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;  field[1] = (value &gt;&gt; 8) &amp; 0xff;</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;  field[2] = value &amp; 0xff;</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;  <span class="keywordflow">return</span> 3;</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;}</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;</div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="numeric_8h.html#a6914ee523b27539f4e441bede8c072b4">   61</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="numeric_8h.html#a6914ee523b27539f4e441bede8c072b4">dtls_int_to_uint32</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *field, uint32_t value)</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;{</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;  field[0] = (value &gt;&gt; 24) &amp; 0xff;</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;  field[1] = (value &gt;&gt; 16) &amp; 0xff;</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;  field[2] = (value &gt;&gt; 8) &amp; 0xff;</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;  field[3] = value &amp; 0xff;</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;  <span class="keywordflow">return</span> 4;</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;}</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;</div>
<div class="line"><a name="l00070"></a><span class="lineno"><a class="line" href="numeric_8h.html#abe324cc4e62d03bdecf457382ba213c8">   70</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="numeric_8h.html#abe324cc4e62d03bdecf457382ba213c8">dtls_int_to_uint48</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *field, uint64_t value)</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;{</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;  field[0] = (value &gt;&gt; 40) &amp; 0xff;</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;  field[1] = (value &gt;&gt; 32) &amp; 0xff;</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;  field[2] = (value &gt;&gt; 24) &amp; 0xff;</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;  field[3] = (value &gt;&gt; 16) &amp; 0xff;</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;  field[4] = (value &gt;&gt; 8) &amp; 0xff;</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;  field[5] = value &amp; 0xff;</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;  <span class="keywordflow">return</span> 6;</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;}</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;</div>
<div class="line"><a name="l00081"></a><span class="lineno"><a class="line" href="numeric_8h.html#ab4d80395fb7f4118dfcb101ae94a5e93">   81</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="numeric_8h.html#ab4d80395fb7f4118dfcb101ae94a5e93">dtls_int_to_uint64</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *field, uint64_t value)</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;{</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;  field[0] = (value &gt;&gt; 56) &amp; 0xff;</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;  field[1] = (value &gt;&gt; 48) &amp; 0xff;</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;  field[2] = (value &gt;&gt; 40) &amp; 0xff;</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;  field[3] = (value &gt;&gt; 32) &amp; 0xff;</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;  field[4] = (value &gt;&gt; 24) &amp; 0xff;</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;  field[5] = (value &gt;&gt; 16) &amp; 0xff;</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;  field[6] = (value &gt;&gt; 8) &amp; 0xff;</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;  field[7] = value &amp; 0xff;</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;  <span class="keywordflow">return</span> 8;</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;}</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;</div>
<div class="line"><a name="l00094"></a><span class="lineno"><a class="line" href="numeric_8h.html#a7293cc28604d896cfef802b53b0ad99f">   94</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint8_t <a class="code" href="numeric_8h.html#a7293cc28604d896cfef802b53b0ad99f">dtls_uint8_to_int</a>(<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *field)</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;{</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;  <span class="keywordflow">return</span> (uint8_t)field[0];</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;}</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;</div>
<div class="line"><a name="l00099"></a><span class="lineno"><a class="line" href="numeric_8h.html#ae32dd0743658f1aa5a723d5a8357521f">   99</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint16_t <a class="code" href="numeric_8h.html#ae32dd0743658f1aa5a723d5a8357521f">dtls_uint16_to_int</a>(<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *field)</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;{</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;  <span class="keywordflow">return</span> ((uint16_t)field[0] &lt;&lt; 8)</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;     | (uint16_t)field[1];</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;}</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;</div>
<div class="line"><a name="l00105"></a><span class="lineno"><a class="line" href="numeric_8h.html#a238931e9197ce422acfba569deb2af71">  105</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code" href="numeric_8h.html#a238931e9197ce422acfba569deb2af71">dtls_uint24_to_int</a>(<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *field)</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;{</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;  <span class="keywordflow">return</span> ((uint32_t)field[0] &lt;&lt; 16)</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;     | ((uint32_t)field[1] &lt;&lt; 8)</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;     | (uint32_t)field[2];</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;}</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;</div>
<div class="line"><a name="l00112"></a><span class="lineno"><a class="line" href="numeric_8h.html#a91f840f763f90c6d88a267011edf86d0">  112</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code" href="numeric_8h.html#a91f840f763f90c6d88a267011edf86d0">dtls_uint32_to_int</a>(<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *field)</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;{</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;  <span class="keywordflow">return</span> ((uint32_t)field[0] &lt;&lt; 24)</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;     | ((uint32_t)field[1] &lt;&lt; 16)</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;     | ((uint32_t)field[2] &lt;&lt; 8)</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;     | (uint32_t)field[3];</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;}</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;</div>
<div class="line"><a name="l00120"></a><span class="lineno"><a class="line" href="numeric_8h.html#ae25d1d32eab6fe59318506984ebc23af">  120</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint64_t <a class="code" href="numeric_8h.html#ae25d1d32eab6fe59318506984ebc23af">dtls_uint48_to_int</a>(<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *field)</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;{</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;  <span class="keywordflow">return</span> ((uint64_t)field[0] &lt;&lt; 40)</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;     | ((uint64_t)field[1] &lt;&lt; 32)</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;     | ((uint64_t)field[2] &lt;&lt; 24)</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;     | ((uint64_t)field[3] &lt;&lt; 16)</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;     | ((uint64_t)field[4] &lt;&lt; 8)</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;     | (uint64_t)field[5];</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;}</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;</div>
<div class="line"><a name="l00130"></a><span class="lineno"><a class="line" href="numeric_8h.html#aa7dcbb31a4c4319903f41008f1f311ae">  130</a></span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> uint64_t <a class="code" href="numeric_8h.html#aa7dcbb31a4c4319903f41008f1f311ae">dtls_uint64_to_int</a>(<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *field)</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;{</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;  <span class="keywordflow">return</span> ((uint64_t)field[0] &lt;&lt; 56)</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;     | ((uint64_t)field[1] &lt;&lt; 48)</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;     | ((uint64_t)field[2] &lt;&lt; 40)</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;     | ((uint64_t)field[3] &lt;&lt; 32)</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;     | ((uint64_t)field[4] &lt;&lt; 24)</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;     | ((uint64_t)field[5] &lt;&lt; 16)</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;     | ((uint64_t)field[6] &lt;&lt; 8)</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;     | (uint64_t)field[7];</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;}</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* _DTLS_NUMERIC_H_ */</span><span class="preprocessor"></span></div>
<div class="ttc" id="numeric_8h_html_a91f840f763f90c6d88a267011edf86d0"><div class="ttname"><a href="numeric_8h.html#a91f840f763f90c6d88a267011edf86d0">dtls_uint32_to_int</a></div><div class="ttdeci">static uint32_t dtls_uint32_to_int(const unsigned char *field)</div><div class="ttdef"><b>Definition:</b> <a href="numeric_8h_source.html#l00112">numeric.h:112</a></div></div>
<div class="ttc" id="numeric_8h_html_aa7dcbb31a4c4319903f41008f1f311ae"><div class="ttname"><a href="numeric_8h.html#aa7dcbb31a4c4319903f41008f1f311ae">dtls_uint64_to_int</a></div><div class="ttdeci">static uint64_t dtls_uint64_to_int(const unsigned char *field)</div><div class="ttdef"><b>Definition:</b> <a href="numeric_8h_source.html#l00130">numeric.h:130</a></div></div>
<div class="ttc" id="numeric_8h_html_abe324cc4e62d03bdecf457382ba213c8"><div class="ttname"><a href="numeric_8h.html#abe324cc4e62d03bdecf457382ba213c8">dtls_int_to_uint48</a></div><div class="ttdeci">static int dtls_int_to_uint48(unsigned char *field, uint64_t value)</div><div class="ttdef"><b>Definition:</b> <a href="numeric_8h_source.html#l00070">numeric.h:70</a></div></div>
<div class="ttc" id="numeric_8h_html_aff276cdd846cd194a21e9c61549292f6"><div class="ttname"><a href="numeric_8h.html#aff276cdd846cd194a21e9c61549292f6">dtls_int_to_uint24</a></div><div class="ttdeci">static int dtls_int_to_uint24(unsigned char *field, uint32_t value)</div><div class="ttdef"><b>Definition:</b> <a href="numeric_8h_source.html#l00053">numeric.h:53</a></div></div>
<div class="ttc" id="numeric_8h_html_a7293cc28604d896cfef802b53b0ad99f"><div class="ttname"><a href="numeric_8h.html#a7293cc28604d896cfef802b53b0ad99f">dtls_uint8_to_int</a></div><div class="ttdeci">static uint8_t dtls_uint8_to_int(const unsigned char *field)</div><div class="ttdef"><b>Definition:</b> <a href="numeric_8h_source.html#l00094">numeric.h:94</a></div></div>
<div class="ttc" id="numeric_8h_html_ab4d80395fb7f4118dfcb101ae94a5e93"><div class="ttname"><a href="numeric_8h.html#ab4d80395fb7f4118dfcb101ae94a5e93">dtls_int_to_uint64</a></div><div class="ttdeci">static int dtls_int_to_uint64(unsigned char *field, uint64_t value)</div><div class="ttdef"><b>Definition:</b> <a href="numeric_8h_source.html#l00081">numeric.h:81</a></div></div>
<div class="ttc" id="numeric_8h_html_a074d352855e1ffde4c2ddb6a6fea01b9"><div class="ttname"><a href="numeric_8h.html#a074d352855e1ffde4c2ddb6a6fea01b9">dtls_int_to_uint16</a></div><div class="ttdeci">static int dtls_int_to_uint16(unsigned char *field, uint16_t value)</div><div class="ttdef"><b>Definition:</b> <a href="numeric_8h_source.html#l00046">numeric.h:46</a></div></div>
<div class="ttc" id="numeric_8h_html_ae32dd0743658f1aa5a723d5a8357521f"><div class="ttname"><a href="numeric_8h.html#ae32dd0743658f1aa5a723d5a8357521f">dtls_uint16_to_int</a></div><div class="ttdeci">static uint16_t dtls_uint16_to_int(const unsigned char *field)</div><div class="ttdef"><b>Definition:</b> <a href="numeric_8h_source.html#l00099">numeric.h:99</a></div></div>
<div class="ttc" id="numeric_8h_html_a6914ee523b27539f4e441bede8c072b4"><div class="ttname"><a href="numeric_8h.html#a6914ee523b27539f4e441bede8c072b4">dtls_int_to_uint32</a></div><div class="ttdeci">static int dtls_int_to_uint32(unsigned char *field, uint32_t value)</div><div class="ttdef"><b>Definition:</b> <a href="numeric_8h_source.html#l00061">numeric.h:61</a></div></div>
<div class="ttc" id="numeric_8h_html_ae25d1d32eab6fe59318506984ebc23af"><div class="ttname"><a href="numeric_8h.html#ae25d1d32eab6fe59318506984ebc23af">dtls_uint48_to_int</a></div><div class="ttdeci">static uint64_t dtls_uint48_to_int(const unsigned char *field)</div><div class="ttdef"><b>Definition:</b> <a href="numeric_8h_source.html#l00120">numeric.h:120</a></div></div>
<div class="ttc" id="numeric_8h_html_a7b602967e2fc28b0be02bd4585e255d0"><div class="ttname"><a href="numeric_8h.html#a7b602967e2fc28b0be02bd4585e255d0">dtls_int_to_uint8</a></div><div class="ttdeci">static int dtls_int_to_uint8(unsigned char *field, uint8_t value)</div><div class="ttdef"><b>Definition:</b> <a href="numeric_8h_source.html#l00040">numeric.h:40</a></div></div>
<div class="ttc" id="numeric_8h_html_a238931e9197ce422acfba569deb2af71"><div class="ttname"><a href="numeric_8h.html#a238931e9197ce422acfba569deb2af71">dtls_uint24_to_int</a></div><div class="ttdeci">static uint32_t dtls_uint24_to_int(const unsigned char *field)</div><div class="ttdef"><b>Definition:</b> <a href="numeric_8h_source.html#l00105">numeric.h:105</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Feb 27 2015 15:15:33 for tinydtls by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>
